<?php

class Unifeed
{
	protected $feed;
	
	function __construct($feedItem)
	{
		$this->feed = $feedItem;
	}
	
	function getTime()
	{
		$feedTime = $this->feed['date_timestamp'];

		if(!isset($feedTime))
			$feedTime = $this->feed["updated"];
		if(!isset($feedTime))
			$feedTime = $this->feed["published"];
			
		if(gettype($feedTime)=="string")
			$feedTime = parse_w3cdtf($feedTime);
		
		return $feedTime;
	}
	
	function getContent()
	{
		$content = "";
		
		if(isset($this->feed['content']))
			$content = trim($this->feed['content']['encoded']);

		if(strlen($content) == 0)
			$content = trim($this->feed['description']);
		if(strlen($content) == 0)
			$content = trim($this->feed['summary']);

		return $content;
	}
	
	function getTitle()
	{
		return $this->feed['title'];	
	}
	
	function getLink()
	{
		return $this->feed['link'];
	}
}

?>